<!--
    THIS EXAMPLE WAS DOWNLOADED FROM https://echarts.apache.org/examples/zh/editor.html?c=line-marker
-->
<!DOCTYPE html>
<html style="height: 100%">
    <head>
        <meta charset="UTF-8">
        <title>Title</title>
        <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/echarts@5/dist/echarts.min.js"></script>
    <!--    <script src="/static/alerts2/js/echarts.min.js"></script>-->
        <script src="/static/alerts2/js/jquery.min.js"></script>
    </head>
    <body style="height: 100%; margin: 0">
        <div id="container" style="height: 100%"></div>
        <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/echarts@5/dist/echarts.min.js"></script>
        <!-- Uncomment this line if you want to dataTool extension
        <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/echarts@5/dist/extension/dataTool.min.js"></script>
        -->
        <!-- Uncomment this line if you want to use gl extension
        <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/echarts-gl@2/dist/echarts-gl.min.js"></script>
        -->
        <!-- Uncomment this line if you want to echarts-stat extension
        <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/echarts-stat@latest/dist/ecStat.min.js"></script>
        -->
        <!-- Uncomment this line if you want to use map
        <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/echarts@5/map/js/china.js"></script>
        <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/echarts@5/map/js/world.js"></script>
        -->
        <!-- Uncomment these two lines if you want to use bmap extension
        <script type="text/javascript" src="https://api.map.baidu.com/api?v=2.0&ak=<Your Key Here>"></script>
        <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/echarts@5/dist/extension/bmap.min.js"></script>
        -->

        <script type="text/javascript">
    $(
        function () {
            fetchData();
        }
    );

function fetchData() {
        $.ajax({
            type: "GET",
            url: "http://192.168.1.105:8888/api/v1/list_offline/",
            dataType: 'json',
            success: function (res) {
                var offline = res.data
                console.log('fetchData111',offline);
                var myChart = echarts.init(document.getElementById("container"));
                var option = {
        animationDuration: 5000,
        dataZoom: [
        {
            id: 'dataZoomX',
            type: 'slider',
            xAxisIndex: [0],
            filterMode: 'filter'
        }
    ],
    title: {
        text: '掉线变化',
        subtext: '1170项目'
    },
    tooltip: {
        trigger: 'item'
    },
    legend: {
        data: ['益阳', '湘西','长沙','邵阳','张家界','株洲','常德','娄底']
    },
    toolbox: {
        show: true,
        feature: {
            dataZoom: {
                yAxisIndex: 'none'
            },
            dataView: {readOnly: false},
            magicType: {type: ['line', 'bar']},
            restore: {},
            saveAsImage: {}
        }
    },
    xAxis: {
        type: 'category',
        boundaryGap: false,
        data: offline.day
    },
    yAxis: {
        type: 'value',
        axisLabel: {
            formatter: '{value} '
        },
       minInterval: 0.1,
        scale: true
    },
    series: [
        {
            name: '益阳',
            type: 'line',
            data: offline.yys,
            endLabel: {
                show: true,
                color: "#5470C6",
                fontSize: 20,
                formatter:'{a0}'
            },
            "label": {
                "show": true,
                "position": "top",
                "margin": 8
            },
        },
        {
            name: '湘西',
            type: 'line',
            data: offline.xxz,
            endLabel: {
                show: true,
                color: "#91CC75",
                fontSize: 20,
                formatter:'{a0}'
            },
            "label": {
                "show": true,
                "position": "top",
                "margin": 8
            },
        },
                {
            name: '长沙',
            type: 'line',
            data: offline.css,
            endLabel: {
                show: true,
                color: "#FAC858",
                fontSize: 20,
                formatter:'{a0}'
            },
            "label": {
                "show": true,
                "position": "top",
                "margin": 8
            },
        },
                {
            name: '邵阳',
            type: 'line',
            data: offline.sys,
            endLabel: {
                show: true,
                color: "#F07A7A",
                fontSize: 20,
                formatter:'{a0}'
            },
            "label": {
                "show": true,
                "position": "top",
                "margin": 8
            },
        },
                {
            name: '张家界',
            type: 'line',
            data: offline.zjjs,
            endLabel: {
                show: true,
                color: "#73C0DE",
                fontSize: 20,
                formatter:'{a0}'
            },
            "label": {
                "show": true,
                "position": "top",
                "margin": 8
            },
        },
                {
            name: '株洲',
            type: 'line',
            data: offline.zzs,
            endLabel: {
                show: true,
                color: "#3BA272",
                fontSize: 20,
                formatter:'{a0}'
            },
            "label": {
                "show": true,
                "position": "top",
                "margin": 8
            },
        },
                {
            name: '常德',
            type: 'line',
            data: offline.cds,
            endLabel: {
                show: true,
                color: "#FC8452",
                fontSize: 20,
                formatter:'{a0}'
            },
            "label": {
                "show": true,
                "position": "top",
                "margin": 8
            },
        },
                {
            name: '娄底',
            type: 'line',
            data: offline.ld,
            endLabel: {
                show: true,
                color: "#9A60B4",
                fontSize: 20,
                formatter:'{a0}'
            },
            "label": {
                "show": true,
                "position": "top",
                "margin": 8
            },
        },
    ]
};
    myChart.setOption(option);
    window.addEventListener("resize", function () {
        myChart.resize()
    })
            }
        });
    }

// if (option && typeof option === 'object') {
//     myChart.setOption(option);
// }

        </script>
    </body>
</html>